# Makefile for lppf
# Copyright (C) 2007 - 2008, Daniel Ekstr�m

TARGET = lppf
OBJS = libppf.o lppf.o
CC = gcc
CFLAGS += -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
LINK = $(CC) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
VPATH = ./src

PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
DOCDIR ?= $(PREFIX)/share/doc/$(TARGET)

.c.o:
	$(CC) $(CFLAGS) -c $(VPATH)/$*.c

all: $(TARGET)

$(TARGET): $(OBJS)
	$(LINK) -o $(TARGET) $(OBJS) $(LFLAGS)

install:
	-mkdir -p $(DESTDIR)$(BINDIR)
	-mkdir -p $(DESTDIR)$(DOCDIR)
	-install -m 0755 $(TARGET) $(DESTDIR)$(BINDIR)
	-install -m 0644 AUTHORS $(DESTDIR)$(DOCDIR)
	-install -m 0644 COPYING $(DESTDIR)$(DOCDIR)
	-install -m 0644 INSTALL $(DESTDIR)$(DOCDIR)

uninstall:
	-rm -f $(DESTDIR)$(BINDIR)/$(TARGET)
	-rm -f $(DESTDIR)$(DOCDIR)/AUTHORS
	-rm -f $(DESTDIR)$(DOCDIR)/COPYING
	-rm -f $(DESTDIR)$(DOCDIR)/INSTALL
	-rm -rf $(DESTDIR)$(DOCDIR)

clean:
	-rm -f $(TARGET) $(OBJS) $(DEPENDENCIES)

run:
	./$(TARGET)
